package com.com.typhoon.publisher;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.listener.ChannelTopic;

/**
 * @author shuya | dongfeng.zdf@alibaba-inc.com
 * @description
 * @date 2018/10/31 下午2:48
 * @description
 * @modified by
 * @since V2.0.0
 */
@NoArgsConstructor
@AllArgsConstructor
public class RedisMessagePublisher implements  MessagePublisher {
    private RedisTemplate<String, Object> redisTemplate;
    private ChannelTopic topic;

    @Override
    public void publish(String message) {
        this.redisTemplate.convertAndSend(topic.getTopic(),message);
    }
}
